package com.dragon.mmochat.model.enumType;

//上线后此enum不可修改或删除，只可增加
public enum MmochatGangSkillType {
	天生神力(0, 10, 2, 4, 6, 10, "按百分比提高自身物理伤害"),

	万灵遮天(1, 10, 2, 4, 6, 10, "按百分比提高自身法术伤害"),

	金刚护体(2, 10, 2, 4, 6, 10, "按百分比提高自身物理防御"),

	法灵护体(3, 10, 2, 4, 6, 10, "按百分比提高自身法术防御"),

	日月精华(4, 10, 2, 4, 6, 10, "按百分比提高自身气血上限"),

	元魂幻化(5, 10, 0, 0, 0, 10, "提高自身忽视全异常抵抗"),

	万魔不侵(6, 10, 0, 0, 0, 10, "提高自身全异常抵抗");

	// 索引值
	int value;
	// 初级帮派最多研发到maxLevel0级技能,...,顶级最多研发到maxLevel3级技能
	int maxLevel, maxLevel0, maxLevel1, maxLevel2, maxLevel3;
	// 技能效果描述
	String intro;

	MmochatGangSkillType(int value, int maxLevel, int maxLevel0, int maxLevel1,
			int maxLevel2, int maxLevel3, String info) {
		this.value = value;
		this.maxLevel = maxLevel;
		this.maxLevel0 = maxLevel0;
		this.maxLevel1 = maxLevel1;
		this.maxLevel2 = maxLevel2;
		this.maxLevel3 = maxLevel3;
		this.intro = info;
	}

	// 获取帮派最高能研发此技能到几级
	public int maxLevelCanDevelop(MmochatGangLevelType gangType) {
		switch (gangType) {
		case 初级:
			return getMaxLevel0();
		case 中级:
			return getMaxLevel1();
		case 高级:
			return getMaxLevel2();
		case 顶级:
			return getMaxLevel3();
		default:
			break;
		}
		return getMaxLevel0();
	}

	// 研发下一级技能需要帮派等级
	public MmochatGangLevelType getGangLevelNeedToDevelopSkill(int curSkillLevel) {
		if (getMaxLevel0() > curSkillLevel) {
			return MmochatGangLevelType.初级;
		}
		if (getMaxLevel1() > curSkillLevel) {
			return MmochatGangLevelType.中级;
		}
		if (getMaxLevel2() > curSkillLevel) {
			return MmochatGangLevelType.高级;
		}
		if (getMaxLevel3() > curSkillLevel) {
			return MmochatGangLevelType.顶级;
		}
		return MmochatGangLevelType.顶级;
	}

	// 研发下一级技能需要的帮派建设度
	public int getGangBuildNeedToDevelopSkill(int curSkillLevel) {
		switch (this) {
		case 天生神力:
		case 万灵遮天:
		case 金刚护体:
		case 法灵护体:
		case 日月精华: {
			int[] values = new int[] { 100000, 200000, 400000, 600000, 1200000,
					1600000, 3000000, 3600000, 4200000, 4800000 };
			if (curSkillLevel < values.length) {
				return values[curSkillLevel];
			} else {
				return -1;
			}
		}
		case 元魂幻化:
		case 万魔不侵: {
			int[] values = new int[] { 4200000, 4800000, 5400000, 6000000,
					6600000, 7200000, 7800000, 8400000, 9000000, 9600000 };
			if (curSkillLevel < values.length) {
				return values[curSkillLevel];
			} else {
				return -1;
			}
		}
		default:
			break;
		}
		return -1;
	}

	// 成员学习下一级技能需要的帮派建设度
	public int getGangBuildNeedToLearnSkill(int curSkillLevel) {
		curSkillLevel--;
		switch (this) {
		case 天生神力:
		case 万灵遮天:
		case 金刚护体:
		case 法灵护体:
		case 日月精华: {
			int[] values = new int[] { 1500, 2000, 3000, 4000, 5500, 7000,
					10000, 12000, 14000, 16000 };
			if (curSkillLevel < values.length) {
				return values[curSkillLevel];
			} else {
				return 0;
			}
		}
		case 元魂幻化:
		case 万魔不侵: {
			int[] values = new int[] { 14000, 16000, 18000, 20000, 22000,
					24000, 26000, 28000, 30000, 32000 };
			if (curSkillLevel < values.length) {
				return values[curSkillLevel];
			} else {
				return 0;
			}
		}
		default:
			break;
		}
		return 0;
	}

	// 当前技能效果数值(百分比)
	public int getGangSkillEffectPercent(int curSkillLevel) {
		if (curSkillLevel == 0) {
			return 0;
		}
		curSkillLevel--;
		switch (this) {
		case 天生神力:
		case 万灵遮天:
		case 金刚护体:
		case 法灵护体:
		case 日月精华:
		case 元魂幻化:
		case 万魔不侵: {
			int[] values = new int[] { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };
			if (curSkillLevel < values.length) {
				return values[curSkillLevel];
			} else {
				return values[values.length - 1];
			}
		}		
		default:
			break;
		}
		return 0;
	}

	public static MmochatGangSkillType get(int value) {
		for (MmochatGangSkillType type : MmochatGangSkillType.values()) {
			if (type.getValue() == value) {
				return type;
			}
		}
		return null;
	}

	public int getValue() {
		return value;
	}

	public int getMaxLevel0() {
		return maxLevel0;
	}

	public int getMaxLevel1() {
		return maxLevel1;
	}

	public int getMaxLevel2() {
		return maxLevel2;
	}

	public int getMaxLevel3() {
		return maxLevel3;
	}

	public String getIntro() {
		return intro;
	}

	public int getMaxLevel() {
		return maxLevel;
	}

}
